<?php
namespace Utils;
require_once __DIR__ ."\Contains.php";
require_once __DIR__ ."\RequestUtils.php";
require_once __DIR__ ."\RongUtils.php";
require_once __DIR__ ."\UserUtils.php";
require_once __DIR__ ."\TalkUtils.php";
use Utils\UserUtils;
use Lib;
class Analyze {
    public static $LOGIN=null;
    public static $GET=null;
    public static $REGIST=null;
    public static $TALKING=null;
    public static $REQUEST=null;
    public static $TIP=null;
    public static $CHANGEPWD=null;
    public static $SIGNED=null;

    public static function deal($d,$conn) {
    $data= json_decode($d,true); 
        if($data['type']==null)
             return Array("code"=>400,"message"=>"指令错误");
             switch ($data['type']) {
               case Contains::$LOGIN:
               //回调自定义函数
                 return  call_user_func(self::$LOGIN, $d,$conn);
            case Contains::$REGIST:
                return  call_user_func(self::$REGIST, $d,$conn);
            case Contains::$PUSH:
                 call_user_func(self::$PUSH, $d,$conn);
                 return;
            case Contains::$TALKING:
                 call_user_func(self::$TALKING, $d,$conn);
                 return;
            case Contains::$REQUEST:
                 call_user_func(self::$REQUEST, $d,$conn);
                 return;
            case Contains::$GET:
                 call_user_func(self::$GET, $d,$conn);
                 return;
            case Contains::$CHANGEPWD:
                 call_user_func(self::$CHANGEPWD, $d,$conn);
                 return;
            case Contains::$SIGNED:
                 call_user_func(self::$SIGNED, $d,$conn);
                 return;
            case Contains::$TIP:
                 call_user_func(self::$TIP, $d,$conn);
                return;
            default:
                 return Array("code"=>404);
         }
    }
}
